import java.util.Arrays;


public class javademo {
    public static void main(String[] args) {
        int[]array={1,4,3,3,4};
       find(array);
    }
    public static void find(int[]array){
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
        int doublecout= 0;
        for (int i = 0; i < array.length; i+=2) {
            if (doublecout== array.length-1){
                System.out.println("该数字是 "+array[array.length-1]);
                return;
            }
            if (array[i]!=array[i+1]){
                System.out.println("该孤儿数字是 "+array[i]);
                return;
            }
            doublecout+=2;
        }
        System.out.println("66666");
    }
    public static void main6(String[] args) {
       /* int i=1;
        int[]array1={2,5,9,4,1,5};
        int[]arr=new int[i];
        bubbleSort(array1);*/
    }

    public static void main4(String[] args) {
        int[]array1={1,2,3,4,5};
        int[]array2={1,3,2,4,5};
        System.out.print("第一个");
        fax(array1);
        System.out.print("第二个");
        fax(array2);

    }

    /**
     *
     */pulic
   /* public static void only23(int[]array){
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
        for (int i = 0; i < array.length; i++) {
            boolean flag1=false;
            boolean flag2=false;
            if (array[i]!=array[i+1]&&(i+1)== array.length-1){
                System.out.println("该唯一数字为"+array[i+1]);
                return;
            }
            if (array[i]!=array[i+1]&&(i+1)< array.length-1){
                flag1=true;
                if (array[i+1]==array[i+2]){
                    flag2=true;
                }
            }
            if (flag1&&flag2){
                System.out.println("该唯一数字为"+array[i]);
                return ;
            }

        }
    }
*/
    /**
     *
     * @param args//判断数组是否为升序
     */
    public static void fax(int[]array){
        int index= array.length-1;
        for (int i = 0; i < array.length-1; i++) {
            if (array[i]<=array[i+1]){
                index--;
            }
        }
        if (index==0){
            System.out.println("数组是升序的"+Arrays.toString(array));
        }else{
            System.out.println("数组是乱序的"+Arrays.toString(array));
        }
    }
    public static void main2(String[] args) {
        int[]array1={1,6,3,4,44,11};
        int[]array2={1,2,3,4,5,6,7};
        //fax(array1);
        // bubbleSort(array1);
        //binarySearch(array2,4);
        /*int[][]array3={{1,2,3},{4,5,6}};
        int[][]array4=new int[][]{{6,6,6},{8,8,8,}};
        int[][]array5=new int[2][3];
        int[][]array6=new int[2][];
        array6[0]=new int[]{6,6,6};
        array6[1]=new int[]{7,7};
        for (int[]x:array6) {
            for (int y:x) {
                System.out.print(y);
            }
            System.out.println();
        }*/
    }
    /**
     *
     * @param array//实现冒泡排序并打印数组元素
     */
    public static void bubbleSort(int[]array){
        for (int i = 0; i < array.length-1; i++) {
            boolean flag=false;
            for (int j = 0; j < array.length-i-1; j++) {
                if (array[j]>array[j+1]){
                    int index=array[j+1];
                    array[j+1]=array[j];
                    array[j]=index;
                    flag=true;
                }
            }
            if (flag==false){
                System.out.println("数组排序后的结果为  "+Arrays.toString(array));
                return;
            }
        }
        System.out.println("数组排序后的结果为  "+Arrays.toString(array));
        return;
    }

    /**
     *
     * @param args//二分查找有序数组中的指定整数
     */
    public static void binarySearch(int[]array,int point){
        int left=0;
        int right= array.length-1;
        int mid=(left+right)/2;
        while(left<=right){
            if (array[mid]>point){
                right=mid-1;
                mid=(right+left)/2;
            }
            if (array[mid]<point){
                left=mid+1;
                mid=(right+left)/2;
            }
            if (array[mid]==point){
                System.out.println("找到了下标为 "+mid);
                return;
            }
        }
        System.out.println("抱歉没找到");
    }


    public static void main1(String[] args) {
        int[]array1={1,2,3,4,5,6};
        int[]array3=new int[10];
        Arrays.fill(array3,1,9,99);
        for (int x:array3) {
            System.out.println(x);
        }
    }
}
